#ifndef __CM_BASE_BYTE_BUFFER_POOL_H__
#define __CM_BASE_BYTE_BUFFER_POOL_H__

#include "Common.h"
#include "Poco/NotificationQueue.h"

using Poco::UInt32;
using Poco::NotificationQueue;

namespace cm_base
{
    class ByteBuffer;

    class ByteBufferPool
    {
    public:
        ByteBufferPool();
        ~ByteBufferPool();

        bool setup(UInt32 poolSize, size_t bufferLen);
        bool teardown();
        
        virtual ByteBuffer* get();
        virtual ByteBuffer* get(long ms);
        virtual void put(ByteBuffer* pb);

        int getInPoolCount();
        
    protected:
        NotificationQueue m_queue;
        UInt32 m_total;
    };

}

#endif